<?php
/**
 * *******************************************************************************
 * ImportedFiles Interface - Action 08
 * Exclude a file from pool of files waiting import
 * *******************************************************************************
 * @author $Author: damien.viguier@gmail.com $
 * @version $Rev: 27 $
 * @internal $Id: ajx-ui-ImportedFiles-a08.php 27 2013-08-18 14:15:43Z damien.viguier@gmail.com $
 * @internal $LastChangedDate: 2013-08-18 14:15:43 +0000 (Sun, 18 Aug 2013) $
 * @link $HeadURL$
 * *******************************************************************************
 */

include_once './../class/DocTypes.class.php';
include_once './../class/ImportedFiles.class.php';
include_once './../../../lib/AttributesDefManagement.class.php';
error_reporting(E_ERROR);

/* ************************************* */

if(array_key_exists('ImportFileID', $_REQUEST))
{
	$l_s_results = array();
	$l_i_idFile = $_REQUEST['ImportFileID'];
	
	try{
		$l_b_result = ImportedFiles::excludeFileFromImportPool($l_i_idFile);
		if($l_b_result)
			$l_s_results["infos"] = "<br> - File '".$l_i_idFile."' excluded successfully !";
		else
			throw new Exception("Error during exclusion.");
	}
	catch(Exception $e)
	{
		$l_s_results["noresults"] = true;
		$l_s_results["err"] = "<br><strong> ".$e->getMessage()." </strong>";
	}	
}
else
{
	$l_s_results["err"] = "No ID of file identified.";
	$l_s_results["noresults"] = true;
	
}

// Callback for request
echo json_encode($l_s_results);

?>